///////////////////////////////////////////////////////////
//  GameTimerMultimedia.cpp
//  Implementation of the Class GameTimerMultimedia
//  Created on:      11-Jan-2015 4:37:13 PM
//  Original author: Eng. Ahmed Yasser
///////////////////////////////////////////////////////////

#include "GameTimerMultimedia.h"

using EngineGame::EngineUtilities::GameTimerMultimedia;

GameTimerMultimedia::GameTimerMultimedia() 
	: _currentTime(0)
{

}

GameTimerMultimedia::~GameTimerMultimedia()
{
	// end the period of the multimedia timer
	timeEndPeriod(1);
}

GameTimerMultimedia::GameTimerMultimedia(const GameTimerMultimedia& theGameTimerMultimedia)
	: _currentTime(theGameTimerMultimedia._currentTime)
{

}

double GameTimerMultimedia::getElapsedTime()
{
	return (timeGetTime() - _currentTime) * 0.001;
}

void GameTimerMultimedia::initTimer()
{
	_currentTime = 0;

	// Set the period of multimedia clock to 1 ms
	timeBeginPeriod(1);
}

void GameTimerMultimedia::startTimer()
{
	_currentTime = timeGetTime();
}